#城市前十
import pandas as pd
df=pd.read_csv("二手车基本信息.csv")
city_num = df['城市'].value_counts().tolist()[:10]
city_type = df['城市'].value_counts().index.tolist()[:10]
from pyecharts import options as opts
from pyecharts.charts import Pie
from pyecharts.faker import Faker

c = (
    Pie()
    .add("", [list(z) for z in zip(city_type, city_num)])
    .set_colors(["blue", "green", "yellow", "red", "pink", "orange", "purple","black","cyan","gray"])
    .set_global_opts(title_opts=opts.TitleOpts(title="城市前十"))
    .set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}"))
    .render("bigdata/cardata/城市前十.html")
)

